﻿<Window x:Class="XData.Windows.Client.ChangePasswordWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:XData.Windows.Client"
        xmlns:cs="clr-namespace:XData.Windows.Components;assembly=Windows.Components"
        mc:Ignorable="d"
        cs:WindowAttachedProperties.DialogResult="{Binding DialogResult}"
        FocusManager.FocusedElement="{Binding ElementName=OldPasswordBox}"
        Title="Change password" Height="250" Width="400" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
    <Grid Margin="20">
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        
        <Label Grid.Row="1" Content="Current password(_P):" HorizontalAlignment="Right" Margin="10" Target="{Binding ElementName=OldPasswordBox}"/>
        <PasswordBox x:Name="OldPasswordBox" Grid.Row="1" Grid.Column="1" Margin="10"  VerticalContentAlignment="Center" TabIndex="0" 
                     cs:PasswordBoxAttachedProperties.Password="{Binding Path=OldPassword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
        
        <Label Grid.Row="2" Content="New password(_N):" HorizontalAlignment="Right" Margin="10" Target="{Binding ElementName=PasswordBox}"/>
        <PasswordBox x:Name="NewPasswordBox" Grid.Row="2" Grid.Column="1" Margin="10" VerticalContentAlignment="Center" TabIndex="1" MaxLength="20"
                     cs:PasswordBoxAttachedProperties.Password="{Binding Path=NewPassword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />

        <Label Grid.Row="3" Content="Confirm password(_C):" HorizontalAlignment="Right" Margin="10" Target="{Binding ElementName=ConfirmPasswordBox}"/>
        <PasswordBox x:Name="ConfirmPasswordBox" Grid.Row="3" Grid.Column="1" Margin="10" VerticalContentAlignment="Center" TabIndex="2"
                     cs:PasswordBoxAttachedProperties.Password="{Binding Path=ConfirmPassword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
        
        <StackPanel Grid.Row="4" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button Content="Change" Padding="5" Margin="0,0,10,0" TabIndex="3" Command="{Binding ChangeCommand}" />
            <Button Content="Cancel" Padding="5" Margin="0,0,10,0" TabIndex="4" Command="{Binding CancelCommand}" />
        </StackPanel>
    </Grid>
</Window>
